package com.example.design.行为型设计模式.观察者模式;

// 另一个具体观察者（网页显示等）
public class WebDisplay implements Observer {
    private float temperature;
    private float humidity;
    private Subject weatherData;

    public WebDisplay(Subject weatherData) {
        this.weatherData = weatherData;
        weatherData.registerObserver(this);
    }

    @Override
    public void update(float temperature, float humidity, float pressure) {
        this.temperature = temperature;
        this.humidity = humidity;
        display();
    }

    public void display() {
        System.out.println("Web Display - Temperature: " + temperature + "°C, Humidity: " + humidity + "%");
    }
}
